-
-
Notifications
You must be signed in to change notification settings - Fork 443
Use DialogJump to get explorer path #3950
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR simplifies the FileExplorerHelper implementation by replacing custom Windows explorer detection logic with the DialogJump library. This change enables support for third-party file explorer plugins and allows getting paths from the most recent active tab.
- Replaces complex COM-based Windows explorer detection with DialogJump.GetActiveExplorerPath()
- Removes unused imports and over 70 lines of custom z-order and window enumeration code
- Improves string comparison efficiency by using char literal instead of string
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
🥷 Code experts: no user but you matched threshold 10 Jack251970 has most 🧠 knowledge in the files. See details
Knowledge based on git-blame: ✨ Comment |
Be a legend 🏆 by adding a before and after screenshot of the changes you made, especially if they are around UI/UX. |
📝 WalkthroughWalkthroughRefactors FileExplorerHelper to obtain the active File Explorer path via DialogJump.DialogJump.GetActiveExplorerPath(), converting the returned URI to a local path before normalization. Removes COM/window z-order enumeration helpers and unused usings. Adjusts trailing backslash handling to use a char literal. Public method signatures remain unchanged. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant App as Caller
participant FEH as FileExplorerHelper
participant DJ as DialogJump.DialogJump
User->>App: Trigger "GetActiveExplorerPath"
App->>FEH: GetActiveExplorerPath()
FEH->>DJ: GetActiveExplorerPath()
DJ-->>FEH: uriString or null
alt uriString present
FEH->>FEH: Convert to Uri → LocalPath
FEH->>FEH: GetDirectoryPath(localPath)\n(ensure trailing '\\')
FEH-->>App: normalizedPath
else null/empty
FEH-->>App: null
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
Flow.Launcher.Infrastructure/FileExplorerHelper.cs (1)
23-29
: Use Path helpers for separator handling (more robust, self-documenting).Handles both separators and aligns with platform constants.
Apply this diff within the selected lines:
- if (!path.EndsWith('\\')) - { - return path + "\\"; - } + if (!Path.EndsInDirectorySeparator(path)) + { + return path + Path.DirectorySeparatorChar; + }And add (outside the selected lines) at the top of the file:
+using System.IO;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
Flow.Launcher.Infrastructure/FileExplorerHelper.cs
(1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: Yusyuriv
PR: Flow-Launcher/Flow.Launcher#3057
File: Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs:0-0
Timestamp: 2024-11-03T07:40:11.014Z
Learning: In Flow Launcher, when using Windows Forms dialogs (e.g., in `JsonRPCPluginSettings.cs`), path validation is enabled by default in `OpenFileDialog` and `FolderBrowserDialog`, preventing users from selecting invalid paths, but it's possible to opt out of this validation on individual dialogs.
📚 Learning: 2025-07-21T09:19:49.684Z
Learnt from: Jack251970
PR: Flow-Launcher/Flow.Launcher#3854
File: Flow.Launcher/App.xaml.cs:246-262
Timestamp: 2025-07-21T09:19:49.684Z
Learning: In Flow Launcher's App.xaml.cs, the asynchronous plugin initialization task (containing AbstractPluginEnvironment.PreStartPluginExecutablePathUpdate, PluginManager.LoadPlugins, PluginManager.InitializePluginsAsync, and AutoPluginUpdates) does not require additional try-catch error handling according to maintainer Jack251970, as these operations are designed to handle exceptions internally.
Applied to files:
Flow.Launcher.Infrastructure/FileExplorerHelper.cs
📚 Learning: 2025-09-04T11:52:29.074Z
Learnt from: jjw24
PR: Flow-Launcher/Flow.Launcher#3932
File: Flow.Launcher.Core/ExternalPlugins/PluginsManifest.cs:48-55
Timestamp: 2025-09-04T11:52:29.074Z
Learning: In Flow Launcher's PluginsManifest.cs, when dealing with version parsing for the MinimumAppVersion feature, maintainer jjw24 prefers to keep the solution simple rather than implementing comprehensive helper methods for SemVer parsing normalization.
Applied to files:
Flow.Launcher.Infrastructure/FileExplorerHelper.cs
🧬 Code graph analysis (1)
Flow.Launcher.Infrastructure/FileExplorerHelper.cs (1)
Flow.Launcher.Infrastructure/DialogJump/DialogJump.cs (1)
DialogJump
(19-1078)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: gitStream workflow automation
- GitHub Check: gitStream.cm
- GitHub Check: gitStream.cm
- GitHub Check: gitStream.cm
- GitHub Check: gitStream.cm
- GitHub Check: build
🔇 Additional comments (1)
Flow.Launcher.Infrastructure/FileExplorerHelper.cs (1)
12-15
:
Use DialogJump to get explorer path
Follow on with #1018.
If we use
DialogJump
to get explorer path, it can use the third-party explorer plugins and also support to get the path from the most recent tab.